package com.xkcyy.demo.springcloud.simple.userclient;

import com.xkcyy.demo.springcloud.simple.userclient.feign.UserFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * UserClientApplication
 *
 * @author xkcyy
 * @date 2022/4/28
 **/
@SpringBootApplication
@EnableFeignClients
public class UserClientApplication implements CommandLineRunner {
    @Autowired
    UserFeign userFeign;

    public static void main(String[] args) {
        System.setProperty("http.proxyHost", "127.0.0.1");
        System.setProperty("https.proxyHost", "127.0.0.1");
        System.setProperty("http.proxyPort", "8888");
        System.setProperty("https.proxyPort", "8888");
        SpringApplication.run(UserClientApplication.class);
    }

    @Override
    public void run(String... args) throws Exception {
//        HashMap<String, Object> map = new HashMap<>();
//        map.put("123","aaa");
//        map.put("456","bbb");
//        List<String> users = userFeign.listUsers("g1",map);
//        for (String user : users) {
//            System.out.println(user);
//        }
//        UserFeign.FileUploadCommand fileUploadCommand = new UserFeign.FileUploadCommand();
//
//        UserFeign.FileMultipartFile file = new UserFeign.FileMultipartFile(new File("C:\\Users\\xkcyy\\Desktop\\123.html"));
//        fileUploadCommand.setFile(file);
//        System.out.println(file.getBytes().length);
//
//        List<String> results = userFeign.file(fileUploadCommand);
//        for (String user : results) {
//            System.out.println(user);
//        }
    }
}
